package com.xiandou.server.service.impl;

import com.xiandou.model.Demo;
import com.xiandou.service.DemoService;
import com.xiandou.server.dao.DemoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author rocpeng
 */
@RequestMapping("/demo-server")
@RestController
public class DemoServiceImpl implements DemoService {

    @Autowired
    private DemoDao demoDao;

    @Override
    @GetMapping("/{id}")
    public Demo getUser(@PathVariable Long id) throws Exception {

        System.out.println(id);

        Demo byId = demoDao.findById(id);

        System.out.println(byId);

        return demoDao.findById(id);
    }






}
